home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / General / SpriteWorld 1.0b3 / Headers / Frame.h < prev    next >
Text File  |  1993-06-05  |  4KB  |  121 lines

  1. ///--------------------------------------------------------------------------------------
  2. //    Frame.h
  3. //
  4. //    Created:    Wednesday, October 28, 1992 at 8:39:10 PM
  5. //    By:        Tony Myles
  6. //
  7. //    Copyright: © 1991-93 Tony Myles, All rights reserved worldwide
  8. //
  9. //    Description:    constants, structures, and prototypes for frames
  10. ///--------------------------------------------------------------------------------------
  11.  
  12.  
  13. #ifndef __FRAME__
  14. #define __FRAME__
  15.  
  16. #ifndef __QDOFFSCREEN__
  17. #include <QDOffscreen.h>
  18. #endif
  19.  
  20. #ifndef SW_PASCAL
  21. #define SW_PASCAL
  22. #endif
  23.  
  24.  
  25. ///--------------------------------------------------------------------------------------
  26. //    frame type definitions
  27. ///--------------------------------------------------------------------------------------
  28.  
  29. typedef struct FrameRec FrameRec;
  30. typedef FrameRec *FramePtr, **FrameHdl;
  31.  
  32.  
  33. ///--------------------------------------------------------------------------------------
  34. //    frame data structure
  35. ///--------------------------------------------------------------------------------------
  36.  
  37. struct FrameRec
  38. {
  39.     union
  40.     {
  41.         CGrafPtr colorGrafP;            // color port for the frame image
  42.         GrafPtr monoGrafP;            // mono port for the frame image
  43.     } framePort;
  44.  
  45.     union
  46.     {
  47.         PixMapPtr pixMapP;            // pointer color pix map (valid only while locked)
  48.         BitMapPtr bitMapP;            // pointer mono bit map (valid only while locked)
  49.     } framePix;
  50.  
  51.     unsigned long *frameBaseAddr;    // base address of pixel data (valid only while locked)
  52.     unsigned long frameRowBytes;    // number of bytes in a row of the frame
  53.     unsigned long frameRowLongs;    // number of long words in a row of the frame
  54.     short leftAlignFactor;            // used to align the rect.left to the nearest long word 
  55.     short rightAlignFactor;            // used to align the rect.right to the nearest long word
  56.     Boolean isFrameLocked;            // has the frame been locked?
  57.     Boolean isColor;                    // is this a color frame?
  58.  
  59.     Rect frameRect;                    // source image rectangle
  60.     Point offsetPoint;                // image offset factor relative to destination rectangle
  61.     RgnHandle maskRgn;                // image masking region
  62.  
  63.     union
  64.     {
  65.         CGrafPtr colorGrafP;            // color port for the mask image
  66.         GrafPtr monoGrafP;            // mono port for the mask image
  67.     } maskPort;
  68.  
  69.     union
  70.     {
  71.         PixMapPtr pixMapP;            // pointer to color pix map (valid only while locked)
  72.         BitMapPtr bitMapP;            // pointer to mono bit map (valid only while locked)
  73.     } maskPix;
  74.  
  75.     unsigned long *maskBaseAddr;    // base address of mask pixel data (valid only while locked)
  76.     Boolean isMaskLocked;            // has the mask been locked?
  77. };
  78.  
  79.  
  80. ///--------------------------------------------------------------------------------------
  81. //    frame flags constants
  82. ///--------------------------------------------------------------------------------------
  83.  
  84. typedef enum
  85. {
  86.     kNoMask = 0,
  87.     kPixelMask = 1,
  88.     kRegionMask = 2,
  89.     kFatMask = (kPixelMask + kRegionMask)
  90. } MaskType;
  91.  
  92.  
  93. ///--------------------------------------------------------------------------------------
  94. //    frame function prototypes
  95. ///--------------------------------------------------------------------------------------
  96.  
  97. #ifdef __cplusplus
  98. extern "C" {
  99. #endif
  100.  
  101. SW_PASCAL OSErr SWCreateFrame(FramePtr* newFrameP, CGrafPtr srcGrafP, Rect* frameRect);
  102. SW_PASCAL OSErr SWCreateFrameFromCIconResource(FramePtr* newFrameP, short iconResID, MaskType maskType);
  103. SW_PASCAL OSErr SWCreateFrameFromPictResource(FramePtr* newFrameP, short pictResID, short maskResID, MaskType maskType);
  104. SW_PASCAL void SWDisposeFrame(FramePtr oldFrameP);
  105.  
  106. SW_PASCAL void SWSetFrameGWorld(FramePtr srcFrameP, GWorldPtr frameGWorldP);
  107. SW_PASCAL void SWSetFrameMaskRgn(FramePtr srcFrameP, RgnHandle maskRgn);
  108. SW_PASCAL void SWSetFrameMaskGWorld(FramePtr srcFrameP, GWorldPtr maskGWorldP);
  109. SW_PASCAL RgnHandle SWGetFrameMaskRgn(FramePtr srcFrameP);
  110. SW_PASCAL void SWSetFrameRect(FramePtr srcFrameP, Rect* newFrameRect);
  111.  
  112. SW_PASCAL void SWLockFrame(FramePtr srcFrameP);
  113. SW_PASCAL void SWUnlockFrame(FramePtr srcFrameP);
  114.  
  115. SW_PASCAL void SWCopyFrame(FramePtr srcFrameP, FramePtr dstFrameP);
  116.  
  117. #ifdef __cplusplus
  118. };
  119. #endif
  120.  
  121. #endif    /* __FRAME__ */